#ifndef APPLET_H
#define APPLET_H

#include <QWidget>
#include <QDialog>
#include <QPixmap>
#include <QImage>
#include <QTcpServer>
#include <QTcpSocket>
#include <QByteArray>
#include <QFile>
#include <QDir>
#include <QTimer>
#include <QMessageBox>
#include <QPainter>
#include <QMouseEvent>
#include <QGraphicsDropShadowEffect>
#include <QPushButton>

namespace Ui {
class applet;
}

class applet : public QWidget
{
    Q_OBJECT

public:
    explicit applet(QWidget *parent = 0);
    ~applet();
    void setQrCode(QPixmap pixmap,int port);
    void startServerForReceiveFile();
    void closeAll(QTcpSocket * tcp,QFile * file);
    bool openFileAndJudgeType(QTcpSocket * tcp);
    bool verify(QTcpSocket * tcp);
    void setSavePath(QString path);
    void languageReload();

private slots:
    void on_pushButton_clicked();

signals:
    void send_file_update_msg();

private:
    Ui::applet *ui;
    QPixmap g_currentPixmap;

    QTcpServer * g_tcpServer;
    QTcpSocket *g_tcpSocket;
    int g_myPort;
    QTimer * g_timer = new QTimer(this);
    QMessageBox *g_messagebox = new QMessageBox(this);
};

#endif // APPLET_H
